//
//  ViewController.m
//  XML解析作业
//
//  Created by mafeng on 16/8/10.
//  Copyright © 2016年 mafeng. All rights reserved.
//

#import "ViewController.h"
#import "Result.h"
#import "GDataXMLNode.h"
#import "Page.h"
#import "AlbumInfo.h"
@interface ViewController ()
@property (nonatomic, strong) Result *result;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //*************************DOM解析*************************//
    // 关于GDataXMLNode的引入
    // 1. 引入.h与.m文件
    // 2. 引入系统动态库libxml2.tbd(快捷方式)
    // 3. 根据GDateXMLNode头文件提示, 添加/usr/include/libxml2
    // 4. 如果是ARC环境, 需对文件进行MRC编译, 添加-fno-objc-arc
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Cartoon" ofType:@"xml"];
    NSError *error = nil;
    NSData *data = [NSData dataWithContentsOfFile:path];
    GDataXMLDocument *document = [[GDataXMLDocument alloc] initWithData:data options:0 error:&error];
    GDataXMLElement *rootElement = [document rootElement];
    NSLog(@"##########%@", rootElement);
    NSArray *childElements = rootElement.children;
    for (GDataXMLElement *childElement in childElements) {
        NSLog(@"❤️:%@", childElement);
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
